let express = require('express');
let router = express.Router()

// 1.3 引入用户模块的controller
let userController = require('../controller/userController');

router.get('/register', (req, res) => {
  res.render('./user/register')
})
// 1.2 服务器监听用户发送过来的注册新用户请求/adduser
router.post('/adduser', userController.handlePostUser)

// 1.9 添加login页面的路由
router.get('/login', (req, res) => {
  res.render('./user/login')
})

// 2.2 处理登录的post请求
router.post('/login', userController.handleLogin)

// 4.1 处理注销登录
router.get('/logout', userController.handleLogout)
module.exports = router
